package com.crm.report.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.crm.report.mapper.UserBusinessGoalMapper;
import com.crm.report.domain.UserBusinessGoal;
import com.crm.report.service.IUserBusinessGoalService;

/**
 * 周目标管理Service业务层处理
 *
 * @author ruoyi
 * @date 2024-02-29
 */
@Service
public class UserBusinessGoalServiceImpl implements IUserBusinessGoalService {
    @Autowired
    private UserBusinessGoalMapper userBusinessGoalMapper;

    /**
     * 查询周目标管理
     *
     * @param id 周目标管理主键
     * @return 周目标管理
     */
    @Override
    public UserBusinessGoal selectUserBusinessGoalById(Long id) {
        return userBusinessGoalMapper.selectUserBusinessGoalById(id);
    }

    /**
     * 查询周目标管理列表
     *
     * @param userBusinessGoal 周目标管理
     * @return 周目标管理
     */
    @Override
    public List<UserBusinessGoal> selectUserBusinessGoalList(UserBusinessGoal userBusinessGoal) {
        return userBusinessGoalMapper.selectUserBusinessGoalList(userBusinessGoal);
    }

    /**
     * 新增周目标管理
     *
     * @param userBusinessGoal 周目标管理
     * @return 结果
     */
    @Override
    public int insertUserBusinessGoal(UserBusinessGoal userBusinessGoal) {
        userBusinessGoal.setCreateTime(DateUtils.getNowDate());
        return userBusinessGoalMapper.insertUserBusinessGoal(userBusinessGoal);
    }

    /**
     * 修改周目标管理
     *
     * @param userBusinessGoal 周目标管理
     * @return 结果
     */
    @Override
    public int updateUserBusinessGoal(UserBusinessGoal userBusinessGoal) {
        userBusinessGoal.setUpdateTime(DateUtils.getNowDate());
        return userBusinessGoalMapper.updateUserBusinessGoal(userBusinessGoal);
    }

    /**
     * 批量删除周目标管理
     *
     * @param ids 需要删除的周目标管理主键
     * @return 结果
     */
    @Override
    public int deleteUserBusinessGoalByIds(Long[] ids) {
        return userBusinessGoalMapper.deleteUserBusinessGoalByIds(ids);
    }

    /**
     * 删除周目标管理信息
     *
     * @param id 周目标管理主键
     * @return 结果
     */
    @Override
    public int deleteUserBusinessGoalById(Long id) {
        return userBusinessGoalMapper.deleteUserBusinessGoalById(id);
    }

    @Override
    public List<Map<String, Object>> queryUserGoalList(UserBusinessGoal userBusinessGoal) {
        return userBusinessGoalMapper.queryUserGoalList(userBusinessGoal);
    }

    @Override
    public List<Map<String, Object>> queryDeptGoalList(UserBusinessGoal userBusinessGoal) {
        return userBusinessGoalMapper.queryDeptGoalList(userBusinessGoal);
    }

    @Override
    public List<Map<String, Object>> queryAreaGoalList(UserBusinessGoal userBusinessGoal) {
        return userBusinessGoalMapper.queryAreaGoalList(userBusinessGoal);
    }

    @Override
    public List<Map<String, Object>> indicatorRankingPersonal(UserBusinessGoal userBusinessGoal) {
        return userBusinessGoalMapper.indicatorRankingPersonal(userBusinessGoal);
    }

    @Override
    public List<Map<String, Object>> indicatorRankingDept2(UserBusinessGoal userBusinessGoal) {
        return userBusinessGoalMapper.indicatorRankingDept2(userBusinessGoal);
    }

    @Override
    public List<Map<String, Object>> indicatorRankingDept1(UserBusinessGoal userBusinessGoal) {
        return userBusinessGoalMapper.indicatorRankingDept1(userBusinessGoal);
    }

    @Override
    public List<Map<String, Object>> indicatorRankingSubOrg(UserBusinessGoal userBusinessGoal) {
        return userBusinessGoalMapper.indicatorRankingSubOrg(userBusinessGoal);
    }
    @Override
    public List<Map<String, Object>> queryCompanyGoalList(UserBusinessGoal userBusinessGoal) {
        return userBusinessGoalMapper.queryCompanyGoalList(userBusinessGoal);
    }

    /**
     * 部长指标排行
     *
     * @param userBusinessGoal 周目标管理
     * @return 周目标管理集合
     */
    @Override
    public List<Map<String, Object>> userIndicatorRanking(UserBusinessGoal userBusinessGoal) {
        return userBusinessGoalMapper.userIndicatorRanking(userBusinessGoal);
    }
}
